<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="../org/angular.min.js"></script>
</head>
<body>

<div ng-app="hd" ng-controller="ctrl">
    搜索： <input type="text" ng-model="search">
    <table border="1" width="600px">
        <tr>
            <td>编号</td>
            <td>点击数</td>
            <td>标题</td>
        </tr>
        <tr ng-repeat="(k, v) in list">
            <td>{{v.id}}</td>
            <td>{{v.click}}</td>
            <td>{{v.title}}</td>
        </tr>
    </table>


</div>


<script>
    var m = angular.module('hd', []);
    m.controller('ctrl', ['$scope', '$filter', function ($scope, $filter) {

        $scope.order_data = [
            {id: 1, click: 100, title: '后盾人1'},
            {id: 2, click: 200, title: '后盾人2'},
            {id: 3, click: 300, title: '后盾人3'},
        ];
        //临时数据
        $scope.list = $scope.order_data;
        $scope.$watch('search', function (n, o) {
           // 当没有n为空的时候，不进行过滤
            $scope.list = $filter('filter')($scope.order_data, n);
            console.log($scope.list.length);
        });


    }]);
</script>


</body>
</html>

